﻿<!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
-->

<UserControl x:Class="System.Windows.Controls.Samples.DataPagerSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit">
    <Grid Background="White">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition  Height="Auto"/>
                <RowDefinition Height="200" />
                <RowDefinition Height="200" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" MinWidth="300" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <ContentControl Style="{StaticResource Header}" Content="DisplayMode" />
            <ContentControl Style="{StaticResource Header}" Content="Data" Grid.Column="1" />
            <data:DataGrid Grid.Column="1" Grid.Row="1" ItemsSource="{Binding}" Margin="5" />
            <ListBox ItemsSource="{Binding}" Grid.Row="2" Grid.Column="1" Margin="5">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Name}"/>
                            <TextBlock Text=" - " />
                            <TextBlock Text="{Binding CodeFaa}" />
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>

            <StackPanel Grid.Row="1" Grid.RowSpan="2">
                <TextBlock Style="{StaticResource ApiDescription}" Text="FirstLastNumeric" />
                <data:DataPager DisplayMode="FirstLastNumeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" />
                <TextBlock Style="{StaticResource ApiDescription}" Text="FirstLastPreviousNext" />
                <data:DataPager DisplayMode="FirstLastPreviousNext" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" />
                <TextBlock Style="{StaticResource ApiDescription}" Text="FirstLastPreviousNextNumeric" />
                <data:DataPager DisplayMode="FirstLastPreviousNextNumeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" />
                <TextBlock Style="{StaticResource ApiDescription}" Text="Numeric" />
                <data:DataPager DisplayMode="Numeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" />
                <TextBlock Style="{StaticResource ApiDescription}" Text="PreviousNext" />
                <data:DataPager DisplayMode="PreviousNext" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" />
                <TextBlock Style="{StaticResource ApiDescription}" Text="PreviousNextNumeric" />
                <data:DataPager DisplayMode="PreviousNextNumeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" />
                <CheckBox x:Name="autoEllipsis" Content="AutoEllipsis" Margin="4" />
                <CheckBox x:Name="totalItemCountFixed" Content="IsTotalItemCountFixed" IsChecked="True" Margin="4" />
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <TextBlock Text="NumericButtonCount:" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Margin="4" />
                    <input:NumericUpDown x:Name="numericButtonCount" Value="5" Minimum="0" Maximum="20" VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" Margin="4" />
                    <TextBlock Text="PageSize:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Margin="4" />
                    <input:NumericUpDown Value="{Binding PageSize, Mode=TwoWay}" Minimum="1" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Margin="4" />
                </Grid>
            </StackPanel>
        </Grid>

        <src:SourceViewer xmlns:src="clr-namespace:System.Windows.Controls.Samples;assembly=System.Windows.Controls.Samples.Common" xmlns:sys="clr-namespace:System;assembly=mscorlib">
  <src:SourceFile Path="DataPagerSample.xaml">
    <src:SourceFile.Source>
      <sys:String>&lt;!--
// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.
--&gt;

&lt;UserControl x:Class="System.Windows.Controls.Samples.DataPagerSample"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
    xmlns:input="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"&gt;
    &lt;Grid Background="White"&gt;
        &lt;Grid&gt;
            &lt;Grid.RowDefinitions&gt;
                &lt;RowDefinition  Height="Auto"/&gt;
                &lt;RowDefinition Height="200" /&gt;
                &lt;RowDefinition Height="200" /&gt;
            &lt;/Grid.RowDefinitions&gt;
            &lt;Grid.ColumnDefinitions&gt;
                &lt;ColumnDefinition Width="Auto" MinWidth="300" /&gt;
                &lt;ColumnDefinition Width="*" /&gt;
            &lt;/Grid.ColumnDefinitions&gt;
            &lt;ContentControl Style="{StaticResource Header}" Content="DisplayMode" /&gt;
            &lt;ContentControl Style="{StaticResource Header}" Content="Data" Grid.Column="1" /&gt;
            &lt;data:DataGrid Grid.Column="1" Grid.Row="1" ItemsSource="{Binding}" Margin="5" /&gt;
            &lt;ListBox ItemsSource="{Binding}" Grid.Row="2" Grid.Column="1" Margin="5"&gt;
                &lt;ListBox.ItemTemplate&gt;
                    &lt;DataTemplate&gt;
                        &lt;StackPanel Orientation="Horizontal"&gt;
                            &lt;TextBlock Text="{Binding Name}"/&gt;
                            &lt;TextBlock Text=" - " /&gt;
                            &lt;TextBlock Text="{Binding CodeFaa}" /&gt;
                        &lt;/StackPanel&gt;
                    &lt;/DataTemplate&gt;
                &lt;/ListBox.ItemTemplate&gt;
            &lt;/ListBox&gt;

            &lt;StackPanel Grid.Row="1" Grid.RowSpan="2"&gt;
                &lt;TextBlock Style="{StaticResource ApiDescription}" Text="FirstLastNumeric" /&gt;
                &lt;data:DataPager DisplayMode="FirstLastNumeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" /&gt;
                &lt;TextBlock Style="{StaticResource ApiDescription}" Text="FirstLastPreviousNext" /&gt;
                &lt;data:DataPager DisplayMode="FirstLastPreviousNext" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" /&gt;
                &lt;TextBlock Style="{StaticResource ApiDescription}" Text="FirstLastPreviousNextNumeric" /&gt;
                &lt;data:DataPager DisplayMode="FirstLastPreviousNextNumeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" /&gt;
                &lt;TextBlock Style="{StaticResource ApiDescription}" Text="Numeric" /&gt;
                &lt;data:DataPager DisplayMode="Numeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" /&gt;
                &lt;TextBlock Style="{StaticResource ApiDescription}" Text="PreviousNext" /&gt;
                &lt;data:DataPager DisplayMode="PreviousNext" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" /&gt;
                &lt;TextBlock Style="{StaticResource ApiDescription}" Text="PreviousNextNumeric" /&gt;
                &lt;data:DataPager DisplayMode="PreviousNextNumeric" Margin="0,0,0,4" HorizontalAlignment="Center" Source="{Binding}" NumericButtonCount="{Binding Value, ElementName=numericButtonCount}" AutoEllipsis="{Binding IsChecked, ElementName=autoEllipsis}" IsTotalItemCountFixed="{Binding IsChecked, ElementName=totalItemCountFixed}" /&gt;
                &lt;CheckBox x:Name="autoEllipsis" Content="AutoEllipsis" Margin="4" /&gt;
                &lt;CheckBox x:Name="totalItemCountFixed" Content="IsTotalItemCountFixed" IsChecked="True" Margin="4" /&gt;
                &lt;Grid&gt;
                    &lt;Grid.ColumnDefinitions&gt;
                        &lt;ColumnDefinition /&gt;
                        &lt;ColumnDefinition /&gt;
                    &lt;/Grid.ColumnDefinitions&gt;
                    &lt;Grid.RowDefinitions&gt;
                        &lt;RowDefinition /&gt;
                        &lt;RowDefinition /&gt;
                    &lt;/Grid.RowDefinitions&gt;
                    &lt;TextBlock Text="NumericButtonCount:" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Margin="4" /&gt;
                    &lt;input:NumericUpDown x:Name="numericButtonCount" Value="5" Minimum="0" Maximum="20" VerticalAlignment="Center" Grid.Row="0" Grid.Column="1" Margin="4" /&gt;
                    &lt;TextBlock Text="PageSize:" VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Margin="4" /&gt;
                    &lt;input:NumericUpDown Value="{Binding PageSize, Mode=TwoWay}" Minimum="1" VerticalAlignment="Center" Grid.Row="1" Grid.Column="1" Margin="4" /&gt;
                &lt;/Grid&gt;
            &lt;/StackPanel&gt;
        &lt;/Grid&gt;
    &lt;/Grid&gt;
&lt;/UserControl&gt;
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="DataPagerSample.xaml.cs">
    <src:SourceFile.Source>
      <sys:String>// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System.ComponentModel;
using System.Linq;
using System.Windows.Data;

namespace System.Windows.Controls.Samples
{
    /// &lt;summary&gt;
    /// Sample page demonstrating the DataPager.
    /// &lt;/summary&gt;
    [Sample("DataPager", DifficultyLevel.Basic)]
    [Category("DataPager")]
    public partial class DataPagerSample : UserControl
    {
        /// &lt;summary&gt;
        /// Initializes a DataPagerSample.
        /// &lt;/summary&gt;
        public DataPagerSample()
        {
            InitializeComponent();
            PagedCollectionView pcv = new PagedCollectionView(Airport.SampleAirports.ToArray());
            pcv.PageSize = 6;
            DataContext = pcv;
        }
    }
}
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
  <src:SourceFile Path="DataPagerSample.xaml.vb">
    <src:SourceFile.Source>
      <sys:String>' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.

Imports System.Windows.Data
Imports System.ComponentModel

''' &lt;summary&gt;
''' Sample page demonstrating the DataPager.
''' &lt;/summary&gt;
&lt;Sample("DataPager", DifficultyLevel.Basic)&gt; _
&lt;Category("DataPager")&gt; _
Public Class DataPagerSample
    Inherits UserControl

    ''' &lt;summary&gt;
    ''' Initializes a DataPagerSample.
    ''' &lt;/summary&gt;
    Public Sub New()
        InitializeComponent()
        Dim pcv As PagedCollectionView = New PagedCollectionView(Airport.SampleAirports)
        pcv.PageSize = 6
        DataContext = pcv
    End Sub

End Class
</sys:String>
    </src:SourceFile.Source>
  </src:SourceFile>
</src:SourceViewer>
    </Grid>
</UserControl>
